home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / PInterfaces / Aliases.p < prev    next >
Encoding:
Text File  |  1998-08-17  |  6.8 KB  |  185 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Aliases.p
  3.  
  4.      Contains:    Alias Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8.1
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1989-1995, 1997-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. }
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT Aliases;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __ALIASES__}
  27. {$SETC __ALIASES__ := 1}
  28.  
  29. {$I+}
  30. {$SETC AliasesIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33. {$IFC UNDEFINED __MACTYPES__}
  34. {$I MacTypes.p}
  35. {$ENDC}
  36. {$IFC UNDEFINED __APPLETALK__}
  37. {$I AppleTalk.p}
  38. {$ENDC}
  39. {$IFC UNDEFINED __FILES__}
  40. {$I Files.p}
  41. {$ENDC}
  42.  
  43.  
  44. {$PUSH}
  45. {$ALIGN MAC68K}
  46. {$LibExport+}
  47.  
  48.  
  49. CONST
  50.     rAliasType                    = 'alis';                        {  Aliases are stored as resources of this type  }
  51.  
  52.                                                                 {  define alias resolution action rules mask  }
  53.     kARMMountVol                = $00000001;                    {  mount the volume automatically  }
  54.     kARMNoUI                    = $00000002;                    {  no user interface allowed during resolution  }
  55.     kARMMultVols                = $00000008;                    {  search on multiple volumes  }
  56.     kARMSearch                    = $00000100;                    {  search quickly  }
  57.     kARMSearchMore                = $00000200;                    {  search further  }
  58.     kARMSearchRelFirst            = $00000400;                    {  search target on a relative path first  }
  59.  
  60.                                                                 {  define alias record information types  }
  61.     asiZoneName                    = -3;                            {  get zone name  }
  62.     asiServerName                = -2;                            {  get server name  }
  63.     asiVolumeName                = -1;                            {  get volume name  }
  64.     asiAliasName                = 0;                            {  get aliased file/folder/volume name  }
  65.     asiParentName                = 1;                            {  get parent folder name  }
  66.  
  67. { ResolveAliasFileWithMountFlags options }
  68.     kResolveAliasFileNoUI        = $00000001;                    {  no user interaction during resolution  }
  69.  
  70. { define the alias record that will be the blackbox for the caller }
  71.  
  72. TYPE
  73.     AliasRecordPtr = ^AliasRecord;
  74.     AliasRecord = RECORD
  75.         userType:                OSType;                                    {  appl stored type like creator type  }
  76.         aliasSize:                UInt16;                                    {  alias record size in bytes, for appl usage  }
  77.     END;
  78.  
  79.     AliasPtr                            = ^AliasRecord;
  80.     AliasHandle                            = ^AliasPtr;
  81. { alias record information type }
  82.     AliasInfoType                        = INTEGER;
  83. {  create a new alias between fromFile-target and return alias record handle  }
  84. FUNCTION NewAlias(fromFile: ConstFSSpecPtr; {CONST}VAR target: FSSpec; VAR alias: AliasHandle): OSErr;
  85.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  86.     INLINE $7002, $A823;
  87.     {$ENDC}
  88. { create a minimal new alias for a target and return alias record handle }
  89. FUNCTION NewAliasMinimal({CONST}VAR target: FSSpec; VAR alias: AliasHandle): OSErr;
  90.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  91.     INLINE $7008, $A823;
  92.     {$ENDC}
  93. { create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  }
  94. FUNCTION NewAliasMinimalFromFullPath(fullPathLength: INTEGER; fullPath: UNIV Ptr; zoneName: Str32; serverName: Str31; VAR alias: AliasHandle): OSErr;
  95.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  96.     INLINE $7009, $A823;
  97.     {$ENDC}
  98. { given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. }
  99. FUNCTION ResolveAlias(fromFile: ConstFSSpecPtr; alias: AliasHandle; VAR target: FSSpec; VAR wasChanged: BOOLEAN): OSErr;
  100.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  101.     INLINE $7003, $A823;
  102.     {$ENDC}
  103. { given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. }
  104. FUNCTION GetAliasInfo(alias: AliasHandle; index: AliasInfoType; VAR theString: Str63): OSErr;
  105.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  106.     INLINE $7007, $A823;
  107.     {$ENDC}
  108.  
  109. FUNCTION IsAliasFile({CONST}VAR fileFSSpec: FSSpec; VAR aliasFileFlag: BOOLEAN; VAR folderFlag: BOOLEAN): OSErr;
  110.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  111.     INLINE $702A, $A823;
  112.     {$ENDC}
  113. FUNCTION ResolveAliasWithMountFlags({CONST}VAR fromFile: FSSpec; alias: AliasHandle; VAR target: FSSpec; VAR wasChanged: BOOLEAN; mountFlags: UInt32): OSErr;
  114.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  115.     INLINE $702B, $A823;
  116.     {$ENDC}
  117.   Given a file spec, return target file spec if input file spec is an alias.
  118.   It resolves the entire alias chain or one step of the chain.  It returns
  119.   info about whether the target is a folder or file; and whether the input
  120.   file spec was an alias or not. 
  121. }
  122. FUNCTION ResolveAliasFile(VAR theSpec: FSSpec; resolveAliasChains: BOOLEAN; VAR targetIsFolder: BOOLEAN; VAR wasAliased: BOOLEAN): OSErr;
  123.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  124.     INLINE $700C, $A823;
  125.     {$ENDC}
  126.  
  127. FUNCTION ResolveAliasFileWithMountFlags(VAR theSpec: FSSpec; resolveAliasChains: BOOLEAN; VAR targetIsFolder: BOOLEAN; VAR wasAliased: BOOLEAN; mountFlags: UInt32): OSErr;
  128.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  129.     INLINE $7029, $A823;
  130.     {$ENDC}
  131. FUNCTION FollowFinderAlias(fromFile: ConstFSSpecPtr; alias: AliasHandle; logon: BOOLEAN; VAR target: FSSpec; VAR wasChanged: BOOLEAN): OSErr;
  132.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  133.     INLINE $700F, $A823;
  134.     {$ENDC}
  135.    Low Level Routines 
  136. }
  137. { given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. }
  138. FUNCTION UpdateAlias(fromFile: ConstFSSpecPtr; {CONST}VAR target: FSSpec; alias: AliasHandle; VAR wasChanged: BOOLEAN): OSErr;
  139.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  140.     INLINE $7006, $A823;
  141.     {$ENDC}
  142.  
  143.  
  144. TYPE
  145. {$IFC TYPED_FUNCTION_POINTERS}
  146.     AliasFilterProcPtr = FUNCTION(cpbPtr: CInfoPBPtr; VAR quitFlag: BOOLEAN; myDataPtr: Ptr): BOOLEAN;
  147. {$ELSEC}
  148.     AliasFilterProcPtr = ProcPtr;
  149. {$ENDC}
  150.  
  151.     AliasFilterUPP = UniversalProcPtr;
  152.  
  153. CONST
  154.     uppAliasFilterProcInfo = $00000FD0;
  155.  
  156. FUNCTION NewAliasFilterProc(userRoutine: AliasFilterProcPtr): AliasFilterUPP;
  157.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  158.     INLINE $2E9F;
  159.     {$ENDC}
  160.  
  161. FUNCTION CallAliasFilterProc(cpbPtr: CInfoPBPtr; VAR quitFlag: BOOLEAN; myDataPtr: Ptr; userRoutine: AliasFilterUPP): BOOLEAN;
  162.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  163.     INLINE $205F, $4E90;
  164.     {$ENDC}
  165.  
  166. {  Given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag }
  167. FUNCTION MatchAlias(fromFile: ConstFSSpecPtr; rulesMask: UInt32; alias: AliasHandle; VAR aliasCount: INTEGER; aliasList: FSSpecArrayPtr; VAR needsUpdate: BOOLEAN; aliasFilter: AliasFilterUPP; yourDataPtr: UNIV Ptr): OSErr;
  168.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  169.     INLINE $7005, $A823;
  170.     {$ENDC}
  171.  
  172.  
  173. {$ALIGN RESET}
  174. {$POP}
  175.  
  176. {$SETC UsingIncludes := AliasesIncludes}
  177.  
  178. {$ENDC} {__ALIASES__}
  179.  
  180. {$IFC NOT UsingIncludes}
  181.  END.
  182. {$ENDC}
  183.